//setupProxy.js
const { createProxyMiddleware } = require("http-proxy-middleware");

const matchUrl = "/dev-api"; // 请求是匹配的地址
const target = "http://localhost:3010"; // 目标网址
const prevUrl = "^/dev-api"; // 以/dev-api路径截取
const writeUlr = ""; // 重写请求路径


module.exports = function (app) {
    app.use(
        createProxyMiddleware(matchUrl, {
            target,
            changeOrigin: true,
            pathRewrite: { [prevUrl]: writeUlr },
        })
    );
};
